package edu.uow.devdocs

import org.compass.core.engine.SearchEngineQueryParseException

class GlobalSearchController {
	
	def searchableService

	def search () {
		println params.q
		println params
        if (!params.q?.trim()) {
            return [:]
        }
        try {
			def searchResult = searchableService.search(params.q, params)
            render(view:'search',
				model: [searchResult: searchResult])
        } catch (SearchEngineQueryParseException ex) {
            render(view:'search',
				model:  [parseException: true])
        }
		
	}
}
